package com.example.javapracticaltraining.entity.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.math.BigDecimal;
import lombok.Data;

/**
 * 食材信息表
 * @TableName ingredient
 */
@TableName(value ="ingredient")
@Data
public class Ingredient {
    /**
     * 
     */
    @TableId(value = "ingredient_id", type = IdType.AUTO)
    private Integer ingredientId;

    /**
     * 食材分类ID
     */
    @TableField(value = "category_id")
    private Integer categoryId;

    /**
     * 食材名称
     */
    @TableField(value = "ingredient_name")
    private String ingredientName;

    /**
     * 规格
     */
    @TableField(value = "specification")
    private String specification;

    /**
     * 单位
     */
    @TableField(value = "unit")
    private String unit;

    /**
     * 卡路里(每100g)
     */
    @TableField(value = "calorie")
    private BigDecimal calorie;

    /**
     * 蛋白质(每100g)
     */
    @TableField(value = "protein")
    private BigDecimal protein;

    /**
     * 脂肪(每100g)
     */
    @TableField(value = "fat")
    private BigDecimal fat;

    /**
     * 碳水化合物(每100g)
     */
    @TableField(value = "carbohydrate")
    private BigDecimal carbohydrate;

    /**
     * 维生素
     */
    @TableField(value = "vitamins")
    private String vitamins;

    /**
     * 矿物质
     */
    @TableField(value = "minerals")
    private String minerals;

    /**
     * 过敏信息
     */
    @TableField(value = "allergy_info")
    private String allergyInfo;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Ingredient other = (Ingredient) that;
        return (this.getIngredientId() == null ? other.getIngredientId() == null : this.getIngredientId().equals(other.getIngredientId()))
            && (this.getCategoryId() == null ? other.getCategoryId() == null : this.getCategoryId().equals(other.getCategoryId()))
            && (this.getIngredientName() == null ? other.getIngredientName() == null : this.getIngredientName().equals(other.getIngredientName()))
            && (this.getSpecification() == null ? other.getSpecification() == null : this.getSpecification().equals(other.getSpecification()))
            && (this.getUnit() == null ? other.getUnit() == null : this.getUnit().equals(other.getUnit()))
            && (this.getCalorie() == null ? other.getCalorie() == null : this.getCalorie().equals(other.getCalorie()))
            && (this.getProtein() == null ? other.getProtein() == null : this.getProtein().equals(other.getProtein()))
            && (this.getFat() == null ? other.getFat() == null : this.getFat().equals(other.getFat()))
            && (this.getCarbohydrate() == null ? other.getCarbohydrate() == null : this.getCarbohydrate().equals(other.getCarbohydrate()))
            && (this.getVitamins() == null ? other.getVitamins() == null : this.getVitamins().equals(other.getVitamins()))
            && (this.getMinerals() == null ? other.getMinerals() == null : this.getMinerals().equals(other.getMinerals()))
            && (this.getAllergyInfo() == null ? other.getAllergyInfo() == null : this.getAllergyInfo().equals(other.getAllergyInfo()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getIngredientId() == null) ? 0 : getIngredientId().hashCode());
        result = prime * result + ((getCategoryId() == null) ? 0 : getCategoryId().hashCode());
        result = prime * result + ((getIngredientName() == null) ? 0 : getIngredientName().hashCode());
        result = prime * result + ((getSpecification() == null) ? 0 : getSpecification().hashCode());
        result = prime * result + ((getUnit() == null) ? 0 : getUnit().hashCode());
        result = prime * result + ((getCalorie() == null) ? 0 : getCalorie().hashCode());
        result = prime * result + ((getProtein() == null) ? 0 : getProtein().hashCode());
        result = prime * result + ((getFat() == null) ? 0 : getFat().hashCode());
        result = prime * result + ((getCarbohydrate() == null) ? 0 : getCarbohydrate().hashCode());
        result = prime * result + ((getVitamins() == null) ? 0 : getVitamins().hashCode());
        result = prime * result + ((getMinerals() == null) ? 0 : getMinerals().hashCode());
        result = prime * result + ((getAllergyInfo() == null) ? 0 : getAllergyInfo().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", ingredientId=").append(ingredientId);
        sb.append(", categoryId=").append(categoryId);
        sb.append(", ingredientName=").append(ingredientName);
        sb.append(", specification=").append(specification);
        sb.append(", unit=").append(unit);
        sb.append(", calorie=").append(calorie);
        sb.append(", protein=").append(protein);
        sb.append(", fat=").append(fat);
        sb.append(", carbohydrate=").append(carbohydrate);
        sb.append(", vitamins=").append(vitamins);
        sb.append(", minerals=").append(minerals);
        sb.append(", allergyInfo=").append(allergyInfo);
        sb.append("]");
        return sb.toString();
    }
}